From 867ba1df27b9ed27d2d3ed6d43b536484635da18 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 1 Jul 2013 20:50:44 +0200 Subject: [PATCH] x11: Don't follow dpi and scale from xsettings when GDK_SCALE set If things are hardcoded in the environment, that wins. --- gdk/x11/gdkscreen-x11.c | 1 + gdk/x11/gdkscreen-x11.h | 1 + gdk/x11/gdkwindow-x11.c | 1 + gdk/x11/xsettings-client.c | 20 ++++++++++++-------- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index c615098e4a..19961b52d4 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -1074,6 +1074,7 @@ _gdk_x11_screen_new (GdkDisplay *display, #endif if (scale_str) { + x11_screen->fixed_window_scale = TRUE; x11_screen->window_scale = atol (scale_str); if (x11_screen->window_scale == 0) x11_screen->window_scale = 1; diff --git a/gdk/x11/gdkscreen-x11.h b/gdk/x11/gdkscreen-x11.h index f37b61a542..ce8598e11e 100644 --- a/gdk/x11/gdkscreen-x11.h +++ b/gdk/x11/gdkscreen-x11.h @@ -48,6 +48,7 @@ struct _GdkX11Screen gint primary_monitor; gint window_scale; + gboolean fixed_window_scale; /* Xft resources for the display, used for default values for * the Xft/ XSETTINGS diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 6f8527d412..1198730bb5 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -156,6 +156,7 @@ gdk_window_impl_x11_init (GdkWindowImplX11 *impl) { impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref); + impl->window_scale = 1; } GdkToplevelX11 * diff --git a/gdk/x11/xsettings-client.c b/gdk/x11/xsettings-client.c index 475cbab8a4..2d1c2512d8 100644 --- a/gdk/x11/xsettings-client.c +++ b/gdk/x11/xsettings-client.c @@ -446,14 +446,17 @@ read_settings (GdkX11Screen *x11_screen, /* Since we support scaling we look at the specific Gdk/UnscaledDPI setting if it exists and use that instead of Xft/DPI if it is set */ - setting = g_hash_table_lookup (x11_screen->xsettings, "gdk-unscaled-dpi"); - if (setting) + if (x11_screen->xsettings && !x11_screen->fixed_window_scale) { - copy = g_new0 (GValue, 1); - g_value_init (copy, G_VALUE_TYPE (setting)); - g_value_copy (setting, copy); - g_hash_table_insert (x11_screen->xsettings, - "gtk-xft-dpi", copy); + setting = g_hash_table_lookup (x11_screen->xsettings, "gdk-unscaled-dpi"); + if (setting) + { + copy = g_new0 (GValue, 1); + g_value_init (copy, G_VALUE_TYPE (setting)); + g_value_copy (setting, copy); + g_hash_table_insert (x11_screen->xsettings, + "gtk-xft-dpi", copy); + } } if (do_notify) @@ -462,7 +465,8 @@ read_settings (GdkX11Screen *x11_screen, g_hash_table_unref (old_list); g_value_init (&value, G_TYPE_INT); - if (gdk_screen_get_setting (GDK_SCREEN (x11_screen), + if (!x11_screen->fixed_window_scale && + gdk_screen_get_setting (GDK_SCREEN (x11_screen), "gdk-window-scaling-factor", &value)) _gdk_x11_screen_set_window_scale (x11_screen, g_value_get_int (&value)); -- 2.30.2